package com.bangbang.blog.controller;


import com.bangbang.blog.pojo.TbUsableIntegral;
import com.bangbang.blog.service.impl.TbUsableIntegralServiceImpl;
import com.bangbang.configresult.Result;
import com.bangbang.configresult.ResultEnum;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

/**
 * <p>
 * 可用积分表 前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2021-08-12
 */
@RestController
@RequestMapping("/blog/tbUsableIntegral")
public class TbUsableIntegralController {

    @Autowired
    private TbUsableIntegralServiceImpl tbUsableIntegralService;

    @PostMapping
    @ApiOperation("可用积分的添加方法")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "tbUsableIntegral",value = "可用积分的实体类",required = true,paramType = "body")
    })
    public Result insert(@RequestBody TbUsableIntegral tbUsableIntegral){
        tbUsableIntegralService.insert(tbUsableIntegral);
        return Result.buildResult(ResultEnum.SUCCESS);
    }

    //修改
    @PutMapping
    @ApiOperation("可用积分的修改方法")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "tbUsableIntegral",value = "可用积分的实体类",required = true,paramType = "body")
    })
    public Result update(@RequestBody TbUsableIntegral tbUsableIntegral){
        tbUsableIntegralService.updateById(tbUsableIntegral);
        return Result.buildResult(ResultEnum.SUCCESS);
    }

    //查询
    @GetMapping
    @ApiImplicitParams({
            @ApiImplicitParam(name = "usaId",value = "可用积分id",required = true,paramType = "query")
    })
    public Result select(@RequestParam(required = true)Long usaId){
        tbUsableIntegralService.select(usaId);
        return Result.buildResult(ResultEnum.SUCCESS);
    }
}

